package structures.kys;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import manager.GrowlManager;

public class KysTableDeployObject implements Serializable {

	private static final long serialVersionUID = -1437565537497351249L;
	
	private List<KysTableDeployInfo> multipleList;
	
	public KysTableDeployObject() {
		super();
		clear();
	}

	public void setList(KysTableDeployInfo kysTableDeployInfo, String tableSchemaArrStr) {
		String[] tableSchemaArr = tableSchemaArrStr.split("\n");
		for (String tableSchemas : tableSchemaArr) {
			tableSchemas = tableSchemas.replaceAll("\r", "");
			String[] tableSchema = tableSchemas.split("\\.");
			if(tableSchema.length < 2){
				GrowlManager.addWarning("Wrong Table Format", "Correct format example: <b>PRM.PRM_NTFTMP_COSTUNITS</b>");
				break;
			}
			multipleList.add(new KysTableDeployInfo(kysTableDeployInfo, tableSchema[1], tableSchema[0]));
		}
	}

	public void clear(){
		if(multipleList == null){
			multipleList = new ArrayList<KysTableDeployInfo>();
		}
		multipleList.clear();
	}
	public List<KysTableDeployInfo> getMultipleList() {
		return multipleList;
	}

	public void setMultipleList(List<KysTableDeployInfo> multipleList) {
		this.multipleList = multipleList;
	}
	
}
